From c57c3ae9cc4baf3e193fdd2e7db43ed7657d98a7 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 20 May 2016 16:22:58 +0300 Subject: [PATCH] fix some cargo_compile tests --- tests/test_cargo_compile.rs | 16 ++++++++-------- tests/test_cargo_compile_custom_build.rs | 19 ++++++++++--------- tests/test_cargo_compile_plugins.rs | 3 ++- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/tests/test_cargo_compile.rs b/tests/test_cargo_compile.rs index 2e318790b..c177f4da3 100644 --- a/tests/test_cargo_compile.rs +++ b/tests/test_cargo_compile.rs @@ -267,6 +267,7 @@ test!(cargo_compile_with_warnings_in_the_root_package { assert_that(p.cargo_process("build"), execs() .with_stderr("\ +[COMPILING] foo [..] src[..]foo.rs:1:14: 1:26 warning: function is never used: `dead`, \ #[warn(dead_code)] on by default src[..]foo.rs:1 fn main() {} fn dead() {} @@ -314,16 +315,13 @@ test!(cargo_compile_with_warnings_in_a_dep_package { "#); assert_that(p.cargo_process("build"), - execs() - .with_stderr(&format!("[COMPILING] bar v0.5.0 ({}/bar)\n\ - [COMPILING] foo v0.5.0 ({})\n", - p.url(), - p.url())) - .with_stderr("\ + execs().with_stderr(&format!("\ +[COMPILING] bar v0.5.0 ({url}/bar) [..]warning: function is never used: `dead`[..] -[..]fn dead() {} +[..]fn dead() {{}} [..]^~~~~~~~~~~~ -")); +[COMPILING] foo v0.5.0 ({url}) +", url = p.url()))); assert_that(&p.bin("foo"), existing_file()); @@ -888,6 +886,7 @@ test!(unused_keys { execs().with_status(0) .with_stderr("\ warning: unused manifest key: project.bulid +[COMPILING] foo [..] ")); let mut p = project("bar"); @@ -911,6 +910,7 @@ warning: unused manifest key: project.bulid execs().with_status(0) .with_stderr("\ warning: unused manifest key: lib.build +[COMPILING] foo [..] ")); }); diff --git a/tests/test_cargo_compile_custom_build.rs b/tests/test_cargo_compile_custom_build.rs index d78a23a29..8dce9f08d 100644 --- a/tests/test_cargo_compile_custom_build.rs +++ b/tests/test_cargo_compile_custom_build.rs @@ -32,13 +32,10 @@ test!(custom_build_script_failed { [COMPILING] foo v0.5.0 ({url}) [RUNNING] `rustc build.rs --crate-name build_script_build --crate-type bin [..]` [RUNNING] `[..]build-script-build[..]` -", -url = p.url())) - .with_stderr(&format!("\ -[ERROR] failed to run custom build command for `foo v0.5.0 ({})` +[ERROR] failed to run custom build command for `foo v0.5.0 ({url})` Process didn't exit successfully: `[..]build[..]build-script-build[..]` \ (exit code: 101)", -p.url()))); +url = p.url()))); }); test!(custom_build_env_vars { @@ -133,7 +130,7 @@ test!(custom_build_script_wrong_rustc_flags { assert_that(p.cargo_process("build"), execs().with_status(101) - .with_stderr(&format!("\ + .with_stderr_contains(&format!("\ [ERROR] Only `-l` and `-L` flags are allowed in build script of `foo v0.5.0 ({})`: \ `-aaa -bbb`", p.url()))); @@ -679,7 +676,7 @@ test!(build_deps_not_for_normal { assert_that(p.cargo_process("build").arg("-v").arg("--target").arg(&target), execs().with_status(101) - .with_stderr("\ + .with_stderr_contains("\ [..]lib.rs[..] error: can't find crate for `aaaaa`[..] [..]lib.rs[..] extern crate aaaaa; [..] ^~~~~~~~~~~~~~~~~~~ @@ -819,11 +816,13 @@ test!(output_separate_lines { "#); assert_that(p.cargo_process("build").arg("-v"), execs().with_status(101) - .with_stderr("\ + .with_stderr_contains("\ [COMPILING] foo v0.5.0 (file://[..]) [RUNNING] `rustc build.rs [..]` [RUNNING] `[..]foo-[..]build-script-build[..]` [RUNNING] `rustc [..] --crate-name foo [..] -L foo -l static=foo` +[ERROR] could not find native static library [..] +[ERROR] Could not compile [..] ")); }); @@ -845,11 +844,13 @@ test!(output_separate_lines_new { "#); assert_that(p.cargo_process("build").arg("-v"), execs().with_status(101) - .with_stderr("\ + .with_stderr_contains("\ [COMPILING] foo v0.5.0 (file://[..]) [RUNNING] `rustc build.rs [..]` [RUNNING] `[..]foo-[..]build-script-build[..]` [RUNNING] `rustc [..] --crate-name foo [..] -L foo -l static=foo` +[ERROR] could not find native static library [..] +[ERROR] Could not compile [..] ")); }); diff --git a/tests/test_cargo_compile_plugins.rs b/tests/test_cargo_compile_plugins.rs index 655de4d16..afaf83cce 100644 --- a/tests/test_cargo_compile_plugins.rs +++ b/tests/test_cargo_compile_plugins.rs @@ -262,8 +262,9 @@ test!(native_plugin_dependency_with_custom_ar_linker { foo.build(); assert_that(bar.cargo_process("build").arg("--verbose"), - execs().with_stderr("\ + execs().with_stderr_contains("\ [COMPILING] foo v0.0.1 ([..]) [RUNNING] `rustc [..] -C ar=nonexistent-ar -C linker=nonexistent-linker [..]` +[ERROR] could not exec the linker [..] ")); }); -- 2.30.2